home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libg++ / etc / HINTS < prev    next >
Text File  |  1991-06-28  |  24KB  |  668 lines

  1. BABYL OPTIONS:
  2. Version: 5
  3. Labels:
  4. Note:   This is the header of an rmail file.
  5. Note:   If you are seeing it in rmail,
  6. Note:    it means the file has no messages in it.
  7. 
  8. 1,,
  9. Return-Path: <riedl@cs.purdue.edu>
  10. Received: from oswego.Oswego.EDU by g.oswego.edu (4.0/SMI-4.0)
  11.     id AA08377; Sun, 11 Feb 90 21:33:40 EST
  12. Received: by oswego.Oswego.EDU (5.57/Osw4.1.21)
  13.     id AA00896; Sun, 11 Feb 90 21:33:18 EST
  14. Received: from raid8.cs.purdue.edu by arthur.cs.purdue.edu (5.61/PURDUE_CS-1.2)
  15.     id <AA01233@arthur.cs.purdue.edu>; Sun, 11 Feb 90 21:30:14 -0500
  16. Received: from localhost by raid8.cs.purdue.edu (5.61/PURDUE_CS-1.2)
  17.     id <AA19140@raid8.cs.purdue.edu>; Sun, 11 Feb 90 21:30:08 -0500
  18. Message-Id: <9002120230.AA19140@raid8.cs.purdue.edu>
  19. To: dl@oswego.oswego.edu
  20. Subject: kudos for profiling and libg++
  21. In-Reply-To: Your message of Tue, 09 Jan 90 06:27:17 -0500.
  22.              <9001091127.AA09544@g.oswego.edu> 
  23. Date: Sun, 11 Feb 90 21:30:04 EST
  24. From: riedl@cs.purdue.edu
  25.  
  26. *** EOOH ***
  27. Return-Path: <riedl@cs.purdue.edu>
  28. To: dl@oswego.oswego.edu
  29. Subject: kudos for profiling and libg++
  30. In-Reply-To: Your message of Tue, 09 Jan 90 06:27:17 -0500.
  31.              <9001091127.AA09544@g.oswego.edu> 
  32. Date: Sun, 11 Feb 90 21:30:04 EST
  33. From: riedl@cs.purdue.edu
  34.  
  35. I was having some trouble with the performance of a concurrency
  36. controller I had written, and am very pleased to report that g++
  37. support for profiling, and the excellent libg++ data structure support
  38. saved the day!  I include a detailed description of the problem and
  39. solution below, which you are welcome to send to any of the involved
  40. parties for encouragement, or to publish for bragging rights (:-).
  41.  
  42. Nice job!
  43. John
  44. ------
  45. The basic problem was that two concurrency controllers that I had
  46. written, called T/O and Lock for short, should have had similar
  47. performance characteristics, but didn't.  After some days of work it
  48. became clear that T/O was significantly slower than Lock, for reasons
  49. that I couldn't understand.  I profiled the two routines and found the
  50. profiles to be very similar, as expected, with the exception of a
  51. large number of calls to compare_item in T/O:
  52.  
  53.     calls to compare_item       total time
  54. T/O    118,112       0.43               10.76 seconds
  55. LOCK    6601*[2-3] 0.09 seconds        9.02 seconds
  56.  
  57. (The numbers involved are small because I did the run for 100
  58. transactions.  Real runs will be for several orders of magnitude more
  59. transactions.) 
  60.  
  61. (I don't have an exact number for the number of calls to compare item
  62. for Lock for obscure reasons, but my understanding of the program
  63. makes me confident that it was called 2-3 times for each call to its
  64. parent, which was called 6601 times.)
  65.  
  66. The additional 1.74 seconds spent in T/O could almost all be accounted
  67. for by calls to compare_item and its parent, SLSet::seek.  Since the
  68. data structures involved were relatively small I expected that using a
  69. fancier data structure wouldn't help, but I thought I should test the
  70. potential.  I determined that the data structures involved would grow
  71. to about 300 items, and that items would be accessed much more often
  72. than they would be inserted.  So I timed versions using the linked
  73. list and using AVL trees:
  74.  
  75. program        items    accesses    seconds (user time)
  76. sl-set         300     10,000              7.70
  77. sl-set         300     10,000              7.61
  78. sl-set        3000     10,000             91.35
  79.  
  80. avl-set         300      1,000       0.18
  81. avl-set         300     10,000       0.68
  82. avl-set         300    100,000          6.15
  83. avl-set        3000     10,000          1.48
  84.  
  85. Clearly the AVL tree implementation was far superior, even for small
  86. problem sizes.  I installed the AVL sets in T/O and they solved the
  87. performance problem I was having.  Profiling shows that before the
  88. change:
  89.  
  90.     calls to compare_item       total time
  91. T/O    118,112       0.43               10.76 seconds
  92. LOCK    6601*[2-3] 0.09 seconds        9.02 seconds
  93.  
  94. After the change locking is the same, but:
  95.  
  96. T/O    16,048     0.10 seconds        9.08 seconds
  97.  
  98. The lessons I take from this study are:
  99.  
  100. 1) Linked lists may cause performance problems even if the lists are
  101. relatively short (< 100 items) if they are heavily used.
  102.  
  103. 2) The C++ library can be extremely advantageous.  In this case, I
  104. made a two line change to my program to change to AVL trees.
  105.  
  106. 3) Profiling is essential to understanding program performance.
  107.  
  108. John Riedl
  109.  
  110. 
  111. 1,,
  112. Return-Path: <dl@g.oswego.edu>
  113. Received: from rocky.Oswego.EDU by g.oswego.edu (4.0/SMI-4.0)
  114.     id AA03598; Thu, 8 Feb 90 05:50:05 EST
  115. Received: by oswego.Oswego.EDU (5.57/Osw4.1.21)
  116.     id AA08592; Thu, 8 Feb 90 05:47:12 EST
  117. Received: from life.ai.mit.edu by nisc.nyser.net (5.61/2.1-NYSERNet NISC)
  118.     id AA07649; Thu, 8 Feb 90 05:44:40 -0500
  119. Received: from oswego.Oswego.EDU by life.ai.mit.edu (4.0/AI-4.10) id AA29896; Thu, 8 Feb 90 05:46:04 EST
  120. Received: by oswego.Oswego.EDU (5.57/Osw4.1.21)
  121.     id AA27161; Thu, 8 Feb 90 05:48:41 EST
  122. Received: by g.oswego.edu (4.0/SMI-4.0)
  123.     id AA03595; Thu, 8 Feb 90 05:48:50 EST
  124. Date: Thu, 8 Feb 90 05:48:50 EST
  125. From: dl@g.oswego.edu (Doug Lea)
  126. Message-Id: <9002081048.AA03595@g.oswego.edu>
  127. To: jose@csserver.cs.msstate.edu
  128. Cc: bug-lib-g++@prep.ai.mit.edu
  129. In-Reply-To: Jose Cordova's message of Wed, 7 Feb 90 17:28:57 CST <9002072328.AA07167@CSServer.CS.MsState.Edu>
  130. Subject: Run-time error when using 'get' with an istream object
  131. Reply-To: dl@oswego.oswego.edu
  132.  
  133. *** EOOH ***
  134. Return-Path: <dl@g.oswego.edu>
  135. Date: Thu, 8 Feb 90 05:48:50 EST
  136. From: dl@g.oswego.edu (Doug Lea)
  137. To: jose@csserver.cs.msstate.edu
  138. Cc: bug-lib-g++@prep.ai.mit.edu
  139. In-Reply-To: Jose Cordova's message of Wed, 7 Feb 90 17:28:57 CST <9002072328.AA07167@CSServer.CS.MsState.Edu>
  140. Subject: Run-time error when using 'get' with an istream object
  141. Reply-To: dl@oswego.oswego.edu
  142.  
  143.  
  144. > I am having trouble using the 'get' method for the 'istream' class.
  145. > It generates a 'Segmentation fault' error at run-time.  I know the
  146. > 'istream' is being opened correctly because reading into a 'String'
  147. > object with >> works fine.  Am I doing something wrong ?
  148. > The sample program and "data" illustrate the point:
  149. > main()
  150. > {
  151. >     istream from("data",io_readonly,a_useonly);
  152. >     char *line;
  153. >     from.get(line,15);
  154. >     cout << line;
  155. > }
  156. > Sample "data" file contents:
  157. > word1 word2
  158. > word3
  159.  
  160. There are 3 istream functions for reading char*'s 
  161.  
  162.   istream&      get    (char* s, int n, char terminator = '\n');
  163.   istream&      getline(char* s, int n, char terminator = '\n');
  164.   istream&      gets   (char **s, char terminator = '\n');
  165.  
  166. The first two *require* an allocated char* (they differ only
  167. in how the trailing terminator is handled.) To use them, you
  168. must supply either a char[N] or an allocated char*.
  169. The third automatically allocates space for you, that you should
  170. later delete.
  171.  
  172. For example,
  173.  
  174. main()
  175. {
  176.     istream from("data",io_readonly,a_useonly);
  177.     char *line = new char[16]; // enough for string + null
  178.     char line2[16];
  179.     char* line3 = 0; // `= 0' so delete'able even if never allocated --
  180.                      // Not necessary in this example.
  181.  
  182.     from.get(line,15);
  183.     from.get(line2,15);
  184.     from.gets(&line3,15);  // pass in the addr of line3
  185.  
  186.     cout << line;
  187.     cout << line2;
  188.     cout << line3;
  189.  
  190.     delete line;
  191.     delete line3;
  192. }
  193.  
  194. Using the String class is a very good way to avoid dealing with these
  195. kinds of char* allocation and semantics issues.
  196.  
  197. -Doug
  198.  
  199. 
  200. 1, answered,,
  201. Return-Path: <chowkwan@aerospace.aero.org>
  202. Received: from aerospace.aero.org ([130.221.192.10]) by g.oswego.edu (4.0/SMI-4.0)
  203.     id AA03846; Mon, 5 Feb 90 16:10:27 EST
  204. Received: from antares.aero.org by aerospace.aero.org with SMTP (5.61++/6.0.GT)
  205.     id AA24377 for dl@g.oswego.edu; Mon, 5 Feb 90 13:06:58 -0800
  206. Posted-Date: Mon, 5 Feb 90 13:06:50 PST
  207. Received: from merlin.aero.org by antares.aero.org (4.1/SMI-3.2-A4ant)
  208.     id AA20056 for dl@g.oswego.edu; Mon, 5 Feb 90 13:06:55 PST
  209. Message-Id: <9002052106.AA20056@antares.aero.org>
  210. Received: by merlin.aero.org (4.1/SMI-3.2-A4)
  211.     id AA03654 for dl@g.oswego.edu; Mon, 5 Feb 90 13:06:50 PST
  212. Date: Mon, 5 Feb 90 13:06:50 PST
  213. From: chowkwan@aerospace.aero.org
  214. To: dl@g.oswego.edu
  215. Subject: Checklist for using Map class
  216.  
  217. *** EOOH ***
  218. Return-Path: <chowkwan@aerospace.aero.org>
  219. Posted-Date: Mon, 5 Feb 90 13:06:50 PST
  220. Date: Mon, 5 Feb 90 13:06:50 PST
  221. From: chowkwan@aerospace.aero.org
  222. To: dl@g.oswego.edu
  223. Subject: Checklist for using Map class
  224.  
  225.  
  226. I found your last message of Jan 20 was enough to get me
  227. started using the Map class.  I'm attaching some notes
  228. I made in LaTeX format which are intended to get new
  229. users off and running quickly.  It's pretty much in the
  230. form of a checklist that they can just go down and follow.
  231. I was thinking it might be useful to you as a standard
  232. response to inquiries for help from neophytes like myself.
  233.  
  234.                0          cut here        0
  235. ----------------><--------------------------------><------------------
  236.                0                                    0
  237.  
  238. \documentstyle{article}
  239. \title{Implementing Table Lookup Using the GNU Library}
  240. \begin{document}
  241. \section{Introduction}
  242.  
  243. This note describes how to use the GNU class library Version 1.35.0
  244. to create lookup tables.  
  245. The advantage of using the GNU library is that 
  246. the code to implement tables can be quickly generated.
  247. Hopefully, the code is also more reliable than
  248. what we could write ourselves.
  249. In addition, the library provides four different lookup
  250. mechanisms. It is relatively easy to ``switch engines''
  251. and use the fastest one for our application.
  252.  
  253. This note augments the ``User's Guide to GNU C++ Library''
  254. by filling in some gaps in the manual.
  255. Therefore, it is intended to complement, rather than
  256. replace the original manual.
  257. Section \ref{sec:general} describes the general procedure
  258. for creating a lookup table.  
  259. Section \ref{sec:specific} gives a working example, in this
  260. case the creation of a lookup table for database objects.
  261.  
  262.  
  263. \section{Using the GNU Library to Create a Lookup Table}
  264. \label{sec:general}
  265.  
  266. The GNU library provides four implementations of lookup tables:
  267. threaded AVL trees, splay trees, resizable hash tables, and
  268. chained hash tables.
  269. The hash table implementations provide double hashing.
  270. The class names for these implementations are shown below
  271. in Table \ref{tab:imp}.
  272. All four classes are subclasses of the {\tt Map} class. \\
  273. Therefore, to create a lookup table, you must define a table class based 
  274. on the abstract class {\tt Map} as well as one of the subclasses.
  275. The script {\tt genclass}, provided
  276. with the GNU library, automates this process.
  277.  
  278. \begin{table}[htb]
  279. \centering
  280. \caption{\label{tab:imp} GNU Implementations of Lookup Tables}
  281. \begin{tabular}{||l|l||} \hline
  282. {\bf Class Name} & {\bf Implementation Method} \\ \hline
  283. {\tt AVLMap} & Threaded AVL trees. \\
  284. {\tt SplayMap} & Splay trees. \\
  285. {\tt VHMap} & Resizable hash tables. \\
  286. {\tt CHMap} & Chained hash tables. \\ \hline
  287. \end{tabular} \\
  288. \end{table} 
  289.  
  290.  
  291.  
  292. A {\sl key} refers to the index for the table
  293. and {\sl base value} refers to the basic data
  294. stored in the table that is returned upon
  295. a keyed lookup.
  296. You need to define a hashing function 
  297. and an equality function for the key.
  298. Finally, if you use pointers as your base
  299. value you need to typedef a name for the pointer.
  300. The steps you need to take are shown below.
  301. In these examples, {\tt $<$K$>$} is the name
  302. of the key class, 
  303. {\tt $<$B$>$} the name of the class for the base value,
  304. {\tt $<$BP$>$} the name of the type pointer to base value,
  305. and {\tt $<$M$>$} the name of one of the four {\tt Map} subclasses. \\
  306.  
  307. \begin{tabular}{||r|l|l||} \hline
  308. &&  {\bf Name of } \\
  309. {\bf Step} & {\bf Action} & {\bf Affected File} \\  \hline
  310. 1 & Create functions {\tt $<$K$>$HASH} & {\tt $<$K$>$.defs.h} \\
  311.   & and {\tt $<$K$>$EQ}. &{\tt $<$K$>$.defs.cc }  \\ \hline
  312. 2 & Define {\tt DEFAULT\_INITIAL\_CAPACITY} & {\tt $<$K$>$.defs.h} \\ \hline
  313. 3 & Create typedef {\tt $<$BP$>$}. & {\tt  $<$B$>$.h}  \\
  314.   & for  pointer to base class. & \\ \hline
  315. 4 & Create abstract class with  & {\tt $<$K$>$.$<$BP$>$.Map.h}  \\
  316.   & {\tt genclass -2 $<$K$>$ ref $<$BP$>$ val Map}& 
  317.   {\tt $<$K$>$.$<$BP$>$.Map.cc} \\ \hline
  318. 5 & Edit {\tt $<$K$>$.$<$BP$>$.Map.h} to include &{\tt $<$K$>$.$<$BP$>$.Map.h} \\
  319.   & {\tt $<$K$>$.defs.h} and {\tt  $<$B$>$.h}. &   \\ \hline
  320. 6 & Create table class for specific & {\tt $<$K$>$.$<$BP$>$.$<$M$>$.h} \\
  321.   & lookup implementation method with & {\tt $<$K$>$.$<$BP$>$.$<$M$>$.cc} \\ 
  322.   & {\tt genclass -2 $<$K$>$ ref $<$BP$>$ val $<$M$>$ } & \\ \hline
  323. \end{tabular} \\
  324.  
  325. The {\tt $<$K$>$} and {\tt $<$BP$>$} arguments to {\tt genclass}
  326. can be qualified by either {\tt val} or {\tt ref} depending on
  327. whether the reference is by value or by reference.
  328.  
  329. \section{Example: Table Lookup Class for Database Objects}
  330. \label{sec:specific}
  331.  
  332. In this example, we want to refer to objects from the 
  333. user-defined class {\tt Database} by their names so
  334. the name of the database object is the key to the table.
  335. To accommodate the {\tt Map} class need for   hashing on the key,
  336. the name is represented by a {\tt String} and the
  337. hash function is the library {\tt hashpjw} function
  338. declared in {\tt builtin.h}
  339. Thus {\tt $<$K$>$} is {\tt String},
  340. {\tt $<$B$>$} is {\tt Database}, and
  341. {\tt $<$BP$>$} is {\tt Databasep}.
  342. For this example, the lookup mechanism used is resizable
  343. hash tables which have type {\tt VHMap} so
  344. {\tt $<$M$>$} is {\tt VHMap}.
  345.  
  346. \begin{enumerate}
  347. \item The {\tt Map} classes expect to get
  348. a function called {\tt HStringHASH} 
  349. that takes an argument of type {\tt String} 
  350. so {\tt hashpjw} was wrapped inside
  351. {\tt HStringHASH}.  
  352. Similarly, {\tt HStringEQ} is a wrapper
  353. for the {\tt HString} class operator $=$.
  354. (The $=$ operator is inherited from the {\tt String}
  355. class).
  356. The function headers 
  357. for {\tt HStringHASH} and {\tt HStringEQ} 
  358. go into {\tt HString.defs.h}
  359. and the function bodies into {\tt HString.defs.cc}.
  360.  
  361.  
  362. \item {\tt DEFAULT\_INITIAL\_CAPACITY} was set to {\tt 1021}
  363. in {\tt HString.defs.h}.  You must use the identifier
  364. {\tt DEFAULT\_INITIAL\_CAPACITY} to be consistent with
  365. the {\tt Map} classes.
  366.  
  367. \item Define {\tt Databasep} as a pointer to class
  368. {\tt Database} in {\tt Database.h}.
  369. An identifier other than {\tt Databasep} would
  370. also be acceptable.  You just can't use {\tt Database*}.
  371.  
  372. \item {\tt genclass -2 HString ref Databasep val Map} \\
  373. produces {\tt HString.Databasep.Map.h} and \\
  374. {\tt HString.Databasep.Map.cc}.
  375.  
  376. \item Edit {\tt HString.Databasep.Map.h} to
  377. include {\tt HString.defs.h} and  \\ {\tt Database.h}.
  378.  
  379. \item {\tt genclass -2 HString ref Databasep val VHMap} \\
  380. produces {\tt HString.Databasep.VHMap.h} and \\
  381. {\tt HString.Databasep.VHMap.cc}.
  382. \end{enumerate}
  383.  
  384.  
  385. \end{document}
  386.  
  387.  
  388.  
  389.  
  390.  
  391. 
  392. 1,,
  393. Return-Path: <dl@g.oswego.edu>
  394. Received: from rocky.Oswego.EDU by g.oswego.edu (4.0/SMI-4.0)
  395.     id AA26086; Sat, 3 Feb 90 07:05:17 EST
  396. Received: by oswego.Oswego.EDU (5.57/Osw4.1.19)
  397.     id AA09020; Sat, 3 Feb 90 07:04:44 EST
  398. Received: from life.ai.mit.edu by nisc.nyser.net (5.61/2.1-NYSERNet NISC)
  399.     id AA24615; Sat, 3 Feb 90 07:00:07 -0500
  400. Received: from oswego.Oswego.EDU by life.ai.mit.edu (4.0/AI-4.10) id AA04153; Sat, 3 Feb 90 07:00:15 EST
  401. Received: by oswego.Oswego.EDU (5.57/Osw4.1.19)
  402.     id AA16111; Sat, 3 Feb 90 07:02:52 EST
  403. Received: by g.oswego.edu (4.0/SMI-4.0)
  404.     id AA26081; Sat, 3 Feb 90 07:03:03 EST
  405. Date: Sat, 3 Feb 90 07:03:03 EST
  406. From: dl@g.oswego.edu (Doug Lea)
  407. Message-Id: <9002031203.AA26081@g.oswego.edu>
  408. To: ngo%tammy@harvard.harvard.edu
  409. Cc: bug-lib-g++@prep.ai.mit.edu
  410. In-Reply-To: Tom Ngo's message of Fri, 2 Feb 90 23:42:54 EST <9002030548.AA00886@life.ai.mit.edu>
  411. Subject: Should "operator =" be made to return *this, by convention?
  412. Reply-To: dl@oswego.oswego.edu
  413.  
  414. *** EOOH ***
  415. Return-Path: <dl@g.oswego.edu>
  416. Date: Sat, 3 Feb 90 07:03:03 EST
  417. From: dl@g.oswego.edu (Doug Lea)
  418. To: ngo%tammy@harvard.harvard.edu
  419. Cc: bug-lib-g++@prep.ai.mit.edu
  420. In-Reply-To: Tom Ngo's message of Fri, 2 Feb 90 23:42:54 EST <9002030548.AA00886@life.ai.mit.edu>
  421. Subject: Should "operator =" be made to return *this, by convention?
  422. Reply-To: dl@oswego.oswego.edu
  423.  
  424.  
  425. >     C programmers are accustomed to expecting = to return the value
  426. >     assigned.  However, in a few classes--for example, String, Integer
  427. >     and Rational-- operator == returns void.  Is there a good reason
  428. >     for this?  Could they be made to return String&, Integer& and
  429. >     Rational& *this without causing problems?
  430.  
  431. The reason that X= (+=, -=, etc.) and = operators return void is to
  432. facilitate simple subclassing. While `utility' classes like String,
  433. Integer, etc., are not designed for extensive subclassing (since no
  434. members are virtual (which, in turn is motivated by efficiency
  435. considerations)), it is often convenient to create simple subclasses
  436. like class Line : public String. If you do this, then it is most
  437. desirable that inherited operators return void.  Otherwise, unexpected
  438. type matches often occur. For example, if operator << (ostream&,
  439. Line&) were redefined for Line, but op += were inherited from String,
  440. and had return value String&, then
  441.     { Line l; ...;  cout << (l += "\n"); } 
  442. would invoke op << (ostream&, String&), which is probably not
  443. what anyone would have in mind.  This is avoided by having String::+=
  444. return void, making this usage illegal.
  445.  
  446. Problems like this outweigh the syntactic convenience of supporting
  447. multiple right-associative uses of X= and =. A good rule of thumb
  448. about all this is that no non-virtual member functions should
  449. ever return *this by reference. (This rule is broken in a few places
  450. in libg++ for various reasons though.)
  451.  
  452. -Doug
  453.  
  454. 
  455. 1,,
  456. Return-Path: <dl@g.oswego.edu>
  457. Received: from rocky.Oswego.EDU by g.oswego.edu (4.0/SMI-4.0)
  458.     id AA00741; Thu, 18 Jan 90 06:01:53 EST
  459. Received: by oswego.Oswego.EDU (5.57/Osw4.1.18)
  460.     id AA22159; Thu, 18 Jan 90 06:02:51 EST
  461. Received: from life.ai.mit.edu by nisc.nyser.net (5.61/2.1-NYSERNet NISC)
  462.     id AA22988; Thu, 18 Jan 90 05:56:52 -0500
  463. Received: from oswego.Oswego.EDU by life.ai.mit.edu (4.0/AI-4.10) id AA00267; Thu, 18 Jan 90 05:58:24 EST
  464. Received: by oswego.Oswego.EDU (5.57/Osw4.1.18)
  465.     id AA16327; Thu, 18 Jan 90 06:01:51 EST
  466. Received: by g.oswego.edu (4.0/SMI-4.0)
  467.     id AA00738; Thu, 18 Jan 90 06:00:57 EST
  468. Date: Thu, 18 Jan 90 06:00:57 EST
  469. From: dl@g.oswego.edu (Doug Lea)
  470. Message-Id: <9001181100.AA00738@g.oswego.edu>
  471. To: allen@sscvx1.ssc.gov
  472. Cc: bug-lib-g++@prep.ai.mit.edu
  473. In-Reply-To: Michael Allen's message of Wed, 17 Jan 90 14:56:32 CST <9001172056.AA01056@mdtf05.gov>
  474. Subject: compiling libg++-1.36.3 with g++-1.36.3 on sun4
  475. Reply-To: dl@oswego.oswego.edu
  476.  
  477. *** EOOH ***
  478. Return-Path: <dl@g.oswego.edu>
  479. Date: Thu, 18 Jan 90 06:00:57 EST
  480. From: dl@g.oswego.edu (Doug Lea)
  481. To: allen@sscvx1.ssc.gov
  482. Cc: bug-lib-g++@prep.ai.mit.edu
  483. In-Reply-To: Michael Allen's message of Wed, 17 Jan 90 14:56:32 CST <9001172056.AA01056@mdtf05.gov>
  484. Subject: compiling libg++-1.36.3 with g++-1.36.3 on sun4
  485. Reply-To: dl@oswego.oswego.edu
  486.  
  487.  
  488.  
  489. > 2) several files get flagged as a warning that a volatile funtion does
  490. > return, which appears to be false.
  491.  
  492. Not quite false, but deserving of explanation:
  493.  
  494. libg++ does not (yet) use the experimental g++ exception handling
  495. facilities (they are still too new: Too many things would have to be
  496. redone if the EH features change). So the only exception strategy is
  497. for error traps like Integer::error() to call the function pointed to
  498. by lib_error_handler (see builtin.h). By default, this points to
  499. default_two_arg_error_handler, which prints a message on stderr and
  500. aborts. But it *can* be reset to do anything at all, and need not
  501. abort execution. On the other hand, *some* (not all) error() member
  502. functions are used in a way that preclude any kind of sensible
  503. continuation even if error() returns. I mark these as `volatile',
  504. since the compiler might as well act as if they cannot return: This is
  505. defensible in that even if (*lib_error_handler) returns, things are
  506. going so wrong that you are no worse off if the compiler generates
  507. (usually faster) code assuming execution aborts.  The compiler
  508. correctly warns about these.
  509.  
  510. Again, saner strategies will be employed when the C++ exception
  511. handling situation stabilizes.
  512.  
  513. -Doug
  514.  
  515.  
  516.  
  517. 
  518. 1,,
  519. Summary-line:  8-Jul   rocket!dove@uunet.UU.NET  #install suggestions
  520. Received: from uunet.uu.net by g.Oswego.EDU (4.0/Osw4.1.21)
  521.     id AA03815; Sun, 8 Jul 90 13:35:21 EDT
  522. Received: from rocket.UUCP by uunet.uu.net (5.61/1.14) with UUCP 
  523.     id AA04848; Sun, 8 Jul 90 13:30:17 -0400
  524. Received: from peach.sanders.com by rocket.sanders.com (4.0/SMI-4.0)
  525.     id AA08275; Sun, 8 Jul 90 13:26:44 EDT
  526. Date: Sun, 8 Jul 90 13:26:44 EDT
  527. From: rocket!dove@uunet.UU.NET (Webster Dove)
  528. Message-Id: <9007081726.AA08275@rocket.sanders.com>
  529. Received: by peach.sanders.com (4.0/SMI-4.0)
  530.     id AA02268; Sun, 8 Jul 90 13:26:43 EDT
  531. To: uunet!g.oswego.edu!dl@uunet.UU.NET
  532. In-Reply-To: Doug Lea's message of Sun, 8 Jul 90 09:16:05 EDT <9007081316.AA03717@g>
  533. Subject: install suggestions
  534.  
  535. *** EOOH ***
  536. Date: Sun, 8 Jul 90 13:26:44 EDT
  537. From: rocket!dove@uunet.UU.NET (Webster Dove)
  538. To: uunet!g.oswego.edu!dl@uunet.UU.NET
  539. In-Reply-To: Doug Lea's message of Sun, 8 Jul 90 09:16:05 EDT <9007081316.AA03717@g>
  540. Subject: install suggestions
  541.  
  542. The following are two scripts for making relative shadow trees.  The
  543. first is adapted from X11R3 to use relative rather than absolute paths
  544. (so the stuff can be moved without breaking).  The second is written
  545. in csh because I know that better.
  546.  
  547. In general, I take a GNU release and expand it in a directory.  Then I
  548. create subdirectory "src" and move everything into it.  I backup
  549. src/Makefile (mv Makefile{,-dist}) and make site/arch/os specific one
  550. src/Makefile-sun3-os4.  Then I make subdirectory build-sun3-os4 (e.g.
  551. build-sun3-os4) parallel to src, and setup the shadow tree from inside
  552. build-sun3-os4 using "lndir ../src".
  553.  
  554. You can just setup your distributions to  start at top level with ./src/,
  555. README, ./lndir and ./lndir_make_links.
  556.  
  557. The one thing I would like added is that site (e.g. pathnames) and
  558. arch/os (compiler switches) specific things be included into the
  559. Makefile with include rather than with direct modification.  With that
  560. approach, and docs on how to write the "make.site-include" and
  561. make.archos-include" I could much more easily upgrade to a new release
  562. and maintain the archos distinction.
  563.  
  564. --- /local/bin/lndir (a shell script) ---
  565. #!/bin/sh
  566.  
  567. #
  568. # lndir - create shadow link tree
  569. #
  570.  
  571. # If your master sources are located in /usr/src/X and you would like
  572. # your link tree to be in /usr/local/src/new-X, do the following:
  573. #
  574. #     %  mkdir /usr/local/src/new-X
  575. #    %  cd /usr/local/src/new-X
  576. #     %  lndir ../X
  577. #
  578. # NOTES
  579. #
  580. # 7/19/89 dove
  581. #  use for relative links.  Uses aux script lndir_make_links
  582. #
  583.  
  584. DIRFROM=$1
  585.  
  586. USAGE="Usage: cd todir; $0 fromdir"
  587.  
  588. if [ ! $# = 1 ] ; then
  589.     echo "$USAGE"
  590.     exit 1
  591. fi
  592.  
  593. if [ ! -d $DIRFROM ]
  594. then
  595.     echo "$USAGE"
  596.     exit 1
  597. fi
  598.  
  599. #
  600. # Get the relative directory names
  601. #
  602. DIRLIST=`(cd $DIRFROM;find . \( -type d ! -name 'RCS' \) -print)`
  603.  
  604. start_dir=`pwd`
  605. #
  606. # Make sure the src and dest are not the same.
  607. #
  608. pwd=`pwd`
  609. if [ `(cd $DIRFROM; pwd)` = $pwd ]
  610. then
  611.     echo "FROM and TO are identical!"
  612.     exit 1
  613. fi
  614.  
  615. #
  616. # build the tree of directories in the destination.
  617. #
  618. for dir in $DIRLIST
  619. do
  620.   if [ ! $dir = . ]
  621.   then
  622.      mkdir $dir
  623.   fi
  624. done
  625.  
  626. echo lndir_make_links $DIRFROM
  627. exec lndir_make_links $DIRFROM
  628. ---- /local/bin/lndir_make_links (csh script) ---
  629. #!/bin/csh -f -b
  630. #
  631. # A secondary script called from lndir that actually links the
  632. # files from the remote directory and recurses if necessary.
  633. #
  634. if ( $#argv != 1 ) then
  635.   echo "$0 error: args $*"
  636.   exit 1
  637. endif
  638.  
  639. set fromdir = $argv[1]
  640.  
  641. set pwd=`pwd`
  642. if ( x`(cd $fromdir; pwd)` == x$pwd ) then
  643.     echo "FROM and TO are identical!"
  644.     exit 1
  645. endif
  646.  
  647. foreach i ( `ls $fromdir` )
  648.   if ( -f $fromdir/$i ) ln -s $fromdir/$i .
  649. end
  650.  
  651. set nonomatch
  652. set next_dirs=`glob */.`
  653. unset nonomatch
  654.  
  655. if ( "$next_dirs" != "*/." ) then
  656. #  echo $next_dirs
  657.   foreach i ($next_dirs)
  658.     (cd $i;lndir_make_links ../$fromdir/$i)
  659.   end
  660. endif
  661.  
  662.